<?php include_once('includes.php'); ?>
<?php include_once('includes/header.php'); 	 ?>

<?php
$team=db_fetch_one("SELECT * FROM team WHERE id = ".$_GET["id"]);
$team_info = db_fetch_one("SELECT * FROM team_info WHERE name in (SELECT namphan FROM team_name_matching WHERE luanvo = '$team->name')");

$news = db_fetch_all("SELECT id,title FROM news WHERE title like '%".$team->name."%' limit 0,10");
?>

<div id="loading_div" class="dimmer" style="display: none">
    <img src="img/loading2.gif">
</div>
<div class="clubinfo">
<?php echo $team_info->html; ?>
</div>
<div style="clear: both; height: 5px;">
</div>
<div class="clubdata">
    <div class="menu_tab_box">
        <div class="squad_table">
            <table width="100%" cellspacing="0" cellpadding="1">
                <tbody>
                    <tr>
                        <th colspan="6" align="center">
                            Danh sách cầu thủ<a name="players"></a>
                        </th>
                    </tr>
                    <tr style="height: 1px;">
                        <td colspan="6" style="border-style: none;">
                        </td>
                    </tr>
                    <tr class="tbl_title">
                        <td width="5%">
                            Số
                        </td>
                        <td width="33%">
                            Tên
                        </td>
                        <td width="12%">
                            Vị trí
                        </td>
                        <td width="5%">
                            Số
                        </td>
                        <td width="33%">
                            Tên
                        </td>
                        <td>
                            Vị trí
                        </td>
                    </tr>
					<?php
					$players=db_fetch_all("SELECT * FROM player WHERE team_name in (select namphan from team_name_matching where luanvo = '$team->name')");
					$col = 0;
					foreach($players as $player)
					{
					if($col % 2 == 0)
					{
						?>
						<tr>
						<?php
					}
					?>
                        <td align="center"><?php echo $player->number; ?></td>
                        <td style="text-align: left; padding-left: 3px;">
                            <div id="player_<?php echo $player->id; ?>" onmouseover="show_tip(&quot;player_tip_<?php echo $player->id; ?>&quot;);" onmouseout="hide_tip(&quot;player_tip_<?php echo $player->id; ?>&quot;);">
                                <?php echo $player->name; ?></div>
                        </td>
                        <td align="center"><?php echo $player->position; ?></td>
						<?php
					if($col % 2 == 1)
					{
						?>
						</tr>
						<?php
					}
					?>
					<?php
						$col++;
					}
					?>
                    <tr>
                        <td class="style7" colspan="6" style="height: 30px" valign="middle">
                            &nbsp;&nbsp;&nbsp;<i>Chú ý:</i>&nbsp;&nbsp;&nbsp;Để hiển thị thông tin chi tiết của cầu thủ hãy di con trỏ lên cầu thủ bạn quan tâm!
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
		<?php 
		foreach($players as $player)
		{
		?>
        <div class="xtip" id="player_tip_<?php echo $player->id; ?>" style="visibility: hidden;">
            <div class="ballon">
                <div class="tla" id="tla_player_tip_<?php echo $player->id; ?>" style="display: inline;">
                </div>
                <div class="tra" id="tra_player_tip_<?php echo $player->id; ?>" style="display: none;">
                </div>
                <div id="balloonBody">
                    <h4>
                    </h4>
                    <div class="boxBody">
						<?php echo $player->html; ?>
                    </div>
                    <div class="boxFooter">
                        <p>
                        </p>
                    </div>
                </div>
                <div class="bla" id="bla_player_tip_<?php echo $player->id; ?>" style="display: none;">
                </div>
                <div class="bra" id="bra_player_tip_<?php echo $player->id; ?>" style="display: none;">
                </div>
            </div>
        </div>
		<?php
		}
		?>
    </div>
</div>
<?php
if(count($news) > 0)
{
?>
	Các bài viết có liên quan :
	<ul>
<?php
	foreach($news as $new)
	{
		echo '<li><a href="/news/'.$new->id.'-'.str_replace(" ","_",trim($new->title)).'">'.$new->title.'</a></li>';
	}
?>
	</ul>
<?php
}
?>
<?php include_once('includes/footer.php'); 	 ?>